@extends('default.layouts.adminPublic')
@section('title', '招聘会管理')
@section('headcss')
    @parent
    <link rel="stylesheet" href="{{asset('/default/css/admin/indexList.css')}}">
    @endsection
    @section('content')
            <!--导航开始-->
    <div class="crumb_warp">
        <i class="fa fa-home"></i> <a href="{{url('admin/job_fair')}}">首页</a> &raquo; 招聘会管理
    </div>
    <!--导航结束-->
    <!--结果集标题与导航组件 开始-->

    <div class="con">
        <div class="conMain">
            <div class="result_wrap">
                <div class="search">
                    <form name="Formso" id="Formso" action="{{url('admin/job_fair_list')}}" method="post">
                        {{csrf_field()}}
                        <span>关键字：</span>
                        <span><input name="keyword" class="keyword" id="keyword" placeholder="请输入招聘会名称"
                                     type="text"></span>
                        <select name="recruitment_type" id="recruitment_type" style="width:140px;">
                            <option value="">请选择招聘会类型</option>
                            <option value="1">普通招聘</option>
                            <option value="2">校园招聘</option>
                        </select>
                        <span><input name="submit" class="skeyword" value="搜索" type="submit"></span>
                    </form>
                </div>
                <div class="message" style="margin-top: 15px;">
                    <p><span style="margin-right: 20px; font-size: 15px;"><a href="{{url('admin/job_fair/create')}}"><i
                                        class="fa fa-plus"></i>添加招聘会</a></span>
                        <span>目前共查找到<strong>{{$recruitment->total()}}</strong>个招聘会！且每页显示招聘会记录{{$recruitment->perPage()}}
                            个。</span>
                    </p>
                </div>
            </div>
            <div class="manage">
                @include('flash::message')
            </div>
            <div class="conInfo">
                <form name="thisForm" id="thisForm" action="" method="post">
                    {{csrf_field()}}
                    <div class="conList" id="conList">
                        <dl class="one">
                            <dt><input name="selectall" type="checkbox" value="1" onclick="CheckAll(this)"/></dt>
                            <dd class="fair1">招聘会名称</dd>
                            <dd class="fair2">举办时间</dd>
                            <dd class="fair3">举办单位</dd>
                            <dd class="fair4">联系电话</dd>
                            <dd class="fair5">订展类型</dd>
                            <dd class="fair6">招聘会类型</dd>
                            <dd class="fair7">招聘会操作</dd>
                        </dl>
                        @if(count($recruitment) > 0 )
                            @foreach($recruitment as $v)
                                <dl id="list{{$v->id}}">
                                    <dt><input name="selected_id[]" type="checkbox" value="{{$v->id}}"/></dt>
                                    <dd class="fair1">
                                        <a href="{{url('job_fair_'.$v->id.'.html')}}" target="_blank">{{str_limit($v->job_title,16)}}</a>
                                    </dd>
                                    <dd class="fair2">
                                        @if($v->hold_time  >= date('Y-m-d',time()))
                                            <span style="color: #ff4400">{{$v->hold_time}}</span>
                                        @else
                                            <span style="color: #777">{{$v->hold_time}}</span>
                                        @endif
                                    </dd>
                                    <dd class="fair3">{{str_limit($v->hold_unit,16)}}</dd>
                                    <dd class="fair4">{{str_limit($v->phone,16)}}</dd>
                                    <dd class="fair5">
                                        @if($v->exhibition == '1')
                                            <span style="color: #2ca02c">开启订展</span>
                                        @else
                                            <span style="color: #bbb">关闭订展</span>
                                        @endif
                                    </dd>
                                    <dd class="fair6">
                                        @if($v->recruitment_type == '1')
                                            <span style="color: #ff4400">普通招聘</span>
                                        @else
                                            <span style="color: #2ca02c">校园招聘</span>
                                        @endif
                                    </dd>
                                    <dd class="fair7">
                                        <span><a href="{{url('admin/job_fair/'.$v->id.'/edit')}}">修改招聘会</a></span>
                                        <span><a onclick="delAd({{$v->id}})">删除招聘会</a></span>
                                        <span><a href="{{url('admin/signup/'.$v->id)}}">查看报名</a></span>
                                    </dd>
                                </dl>
                            @endforeach
                        @else
                            <div class="nullcon">对不起！没有招聘会条件的记录！</div>
                        @endif
                        <dl class="last">
                            <dt>
                                <input name="selectall" id="selectall" type="checkbox" value="1"
                                       onclick="CheckAll(this)"/>
                                <label for="selectall">全选</label>
                            </dt>
                        </dl>
                    </div>
                </form>
                <div class="page_list" style="width: 100%; float: left; margin-top:15px;">
                    {!! $recruitment->links() !!}
                </div>
            </div>

            <div class="stopper" style="margin-top:10px; border-top: 1px solid #e5e5e5"></div>
        </div>
    </div>
    <!--结果集标题与导航组件 结束-->
@endsection

@section('footerjs')
    @parent
    <script type="text/javascript" src="{{asset('/default/js/admin/advertising.js')}}"></script>
    <script>
        //删除招聘会
        function delAd(id){
            layer.confirm('您确定要删除这份招聘会吗？', {
                btn: ['确定', '取消'] //按钮
            }, function(){
                $.post("{{url('admin/job_fair/')}}/" + id, {
                    '_method': 'delete',
                    '_token': "{{csrf_token()}}"
                }, function(data){
                    if(data.status == 0){
                        layer.msg(data.msg, {icon: 6, time: 1500});
                        $("#thisForm").find('#conList').find("#list" + id).remove();
                    }else{
                        layer.msg(data.msg, {icon: 5, time: 1500});
                    }
                });
            });
        }
    </script>
@endsection